import {
  getTimestamp,
  filterTimeHMS
} from './time'
const Finance = class Finance {
  constructor(props) {
    this.realName = props.realName;
    this.mobile = props.mobile;
    this.time = props.time;
    this.size = props.size;
    this.page = props.page;
    this.time = props.time;
    this.borrowId = props.borrowId;
    this.flag = props.flag;
  }
  getState() {
    let x = {}
    // 姓名
    if (this.realName) {
      x.realName = this.realName
    }
    //手机号
    if (this.mobile) {
      if (!/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(this.mobile)) {
        return {
          code: '0',
          message: '请输入正确的手机号'
        }
      } else {
        x.mobile = this.mobile
      }
    }
    // 入催时间开始   或入账时间
    if (this.time) {
      x.startTime = this.time ? getTimestamp(this.time[0]) : undefined;
      x.endTime = this.time ? getTimestamp(this.time[1]) + 86399999 : undefined;
    }

    //人工入账流水列表
    if (this.flag) {
      x.flag = this.flag
    }
    if (this.borrowId) {
      x.borrowId = this.borrowId
    }
    x.size = this.size
    x.page = this.page
    return x
  }

}

export default Finance
